<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     Pagizer
 * @subpackage  backoffice
 */

/**
 * Ajax action to check if current url must display in a tab or not
 * Used by loadContent() in jQueryBackend.js
 */
class m_backoffice_actions_AjaxCheckTabAction extends m_backoffice_extends_Action
{
	public function execute()
	{
		// Get requested url (href)
		$href = $this->getRequestParameter('href');

		// Set to the routing class
		$routing = f_core_Routing::getInstance()->setRequestURL(substr($href,1));
		
		// Check if "tabAction" parameter is set
		$tabName = $this->getRequestParameter("tabAction");
		
		if(is_null($tabName))
		{
			$tabName = $this->getRequestParameter("tabName");
		}
		
		$tabbed = $this->getRequestParameter("tabbed");

		// Return in text for js
		if(!is_null($tabName) || !is_null($tabbed))
		{
			echo "true";
		}
        else
        {
            echo "false";
        }
	}

	public function validate()
	{
		return true;
	}
}